<template>
	<view class="height-100 bg-or overflow-hidden">
		<!-- 患者资料 -->
		<view class="bg-white radius-xl padding margin">
			<view class="flex-direction-row justify-between">
				<view class="">
					<text class="text-df text-bold">患者：</text>
					<text class="text-df color-black-q">{{prescriptionCondition.prescriptionPatient?.name}}</text>
				</view>
				<view class="">
					<text class="text-df text-bold">性别：</text>
					<text class="text-df color-black-q">{{prescriptionCondition.prescriptionPatient?.gender===1?'男':'女'}}</text>
				</view>
				<view class="">
					<text class="text-df text-bold">年龄：</text>
					<text class="text-df color-black-q">{{prescriptionCondition.prescriptionPatient?.age}}岁</text>
				</view>
			</view>
			<view class="padding-tb flex-direction-column">
				<text class="text-df margin-top-sm">身份证信息：{{prescriptionCondition.prescriptionPatient?.idCard}}</text>
				<text class="text-df margin-top-sm">就诊人关系：{{patientRelation[prescriptionCondition.prescriptionPatient?.patientRelation]}}</text>
				<text class="text-df margin-top-sm">联系电话：{{prescriptionCondition.prescriptionPatient?.mobile}}</text>
				<text class="text-df margin-top-sm">所在地区：{{prescriptionCondition.prescriptionPatient?.city + prescriptionCondition.prescriptionPatient?.area}}</text>
			</view>
		</view>
		<!-- 所患疾病 -->
		<view class="bg-white radius-xl padding margin flex-direction-column">
			<text class="text-df color-green">所患疾病：</text>
			<text class="text-df margin-top-sm">{{prescriptionCondition?.diseasesSuffered}}</text>
		</view>
		<!--  -->
		<view class="bg-white radius-xl padding margin">
			<view class="flex-direction-row justify-between align-center padding-tb-sm">
				<text class="text-smd color-black">肝功能</text>
				<text class="text-smd color-black">{{liverArr[prescriptionCondition?.liverFunction]}}</text>
			</view>
			<view class="flex-direction-row justify-between align-center padding-tb-sm">
				<text class="text-smd color-black">肾功能</text>
				<text class="text-smd color-black">{{kidneyArr[prescriptionCondition?.renalFunction]}}</text>
			</view>
			<view class="flex-direction-row justify-between align-center padding-tb-sm">
				<text class="text-smd color-black">过敏史</text>
				<text class="text-smd color-black">{{allergyArr[prescriptionCondition?.allergyHistory]}}</text>
			</view>
			<view class="flex-direction-row justify-between align-center padding-tb-sm">
				<text class="text-smd color-black">生育计划或状态</text>
				<text class="text-smd color-black">{{marriageArr[prescriptionCondition?.familyPlan]}}</text>
			</view>
		</view>
		<!-- 病情描述 -->
		<view class="bg-white radius-xl padding margin flex-direction-column">
			<text class="text-df color-green margin-top">病情描述：</text>
			<text class="text-df margin-top-sm">{{prescriptionCondition?.patientDescription}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(option) {
			this.prescriptionCondition = option.prescriptionCondition && JSON.parse(option.prescriptionCondition)
			console.log('this.prescriptionCondition: ',this.prescriptionCondition);
			console.log('allergyHistory: ',this.prescriptionCondition.allergyHistory);
		},
		data() {
			return {
				prescriptionCondition: {},
				patientRelation:['本人','父母','配偶','子女'],
				liverArr: ['正常', '异常', '不清楚'],
				kidneyArr: ['正常', '异常', '不清楚'],
				allergyArr: ['无', '有', '不清楚'],
				marriageArr: ['无', '准备期', '怀孕期', '不清楚'],
			}
		},
		methods: {
			async getPatient(memberId) {
				const res = await uni.$request.post('/doctorPrescriptionApi/getPatient', {
					memberId: memberId
				});
				console.log('getPatient res: ', res.data);
				if (res.code === 200) {
					this.infos = res.data;
				} else {
					uni.showModal({
						title: '提示',
						content: '数据查询失败',
						showCancel: false
					});
				}
			},
			// 查看原始处方
			openPopup() {
				this.$refs.originalPopup.open();
			},
			closePopup() {
				this.$refs.originalPopup.close();
			},

		}
	}
</script>

<style>

</style>